home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / groupcopyboxcontents.pprx < prev    next >
Text File  |  1993-02-15  |  4KB  |  198 lines

  1. /*
  2. @BGroupCopyBoxContents @P@ICopyright Gold Disk Inc., Jan, 1993
  3.  
  4. This Genie will copy the contents of one box to all boxes in the current group.
  5. */
  6. parse arg source
  7. cr  = '0a'x
  8. address command
  9. call SafeEndEdit.rexx()
  10. call ppm_AutoUpdate(0)
  11. box = ppm_GroupFirstBox()
  12. if box = 0 then exit_msg("Select a group first")
  13.  
  14. if source = '' then
  15. do
  16.  
  17.     source  = ppm_ClickOnBox("Click on box which has contents to be copied..")
  18.     if source = 0 then exit_msg()
  19.  
  20. end
  21.  
  22. info  = ppm_GetBoxInfo(source)
  23. fword = upper(word(info, 1))
  24.  
  25. dellist = ''
  26. grplist = ''
  27.  
  28. if fword = "TEXT" then
  29. do
  30.    copyfunc = "CopyText"
  31.    text  = ppm_GetArticleText(source, 1)
  32.  
  33. end
  34. else if fword = "EMPTY" then copyfunc = "DelContents"
  35. else if fword = "STRUCTURED" | fword = "CLIP" then
  36. do
  37.    copyfunc = "CopyAll"
  38. end
  39. else if fword = "BITMAP" then
  40. do
  41.    copyfunc = "CopyBitMap"
  42.    bitmapfile = substr(info, wordindex(info, 5))
  43. end
  44. else if fword = "EPSF" then
  45. do
  46.    copyfunc = "CopyEPSF"
  47.    epsfile   = substr(info, wordindex(info, 3))
  48. end
  49.  
  50. call ppm_ShowStatus("Working..")
  51. do while box ~= 0
  52.  
  53.    interpret "call "copyfunc"(source, box)"
  54.    box = ppm_GroupNextBox(box)
  55.  
  56. end
  57.  
  58. do while dellist ~= ''
  59.  
  60.    parse var dellist box ';' dellist
  61.  
  62.    if box ~= '' then call ppm_DeleteBox(box)
  63.  
  64. end
  65.  
  66. do while grplist ~= ''
  67.  
  68.    parse var grplist box ';' grplist
  69.  
  70.    if box ~= '' then call AddToGroup(box)
  71.  
  72. end
  73.  
  74. exit_msg()
  75.  
  76. CopyText: procedure expose text
  77. do
  78.    parse arg source, dest
  79.  
  80.    call ppm_DeleteContents(dest)
  81.    call ppm_TextIntoBox(dest, text)
  82.    return
  83.  
  84. end
  85.  
  86. DelContents: procedure
  87. do
  88.    parse arg source, dest
  89.    call ppm_DeleteContents(dest)
  90.    return
  91. end
  92.  
  93. CopyEPSF: procedure expose epsfile
  94. do
  95.    parse arg source, dest
  96.  
  97.    call ppm_DeleteContents(dest)
  98.    call ppm_ImportEPSF(dest, epsfile)
  99.    return
  100. end
  101.  
  102. CopyBitMap: procedure expose bitmapfile
  103. do
  104.    parse arg source, dest
  105.  
  106.    call ppm_DeleteContents(dest)
  107.    call ppm_ImportBM(dest, bitmapfile)
  108.    return
  109. end
  110.  
  111. CopyAll: procedure expose dellist grplist
  112. do
  113.    parse arg source, dest
  114.  
  115.    dpos  = ppm_GetBoxPosition(dest)
  116.    dsize = ppm_GetBoxSize(dest)
  117.     ddata   = ppm_GetBoxFrameData(dest)
  118.     dframe  = ppm_GetBoxFrame(dest)
  119.     dboxoff = ppm_GetBoxOffset(dest)
  120.     dangle  = ppm_GetBoxAngle(dest)
  121.     dimperm = ppm_GetBoxTextWrap(dest)
  122.     dlock   = ppm_GetBoxLock(dest)
  123.     dhide   = ppm_GetBoxHide(dest)
  124.     dtrans  = ppm_GetBoxTransparent(dest)
  125.     dsoff   = ppm_GetBoxStandOff(dest)
  126.     dmargs  = ppm_GetBoxMargins(dest)
  127.  
  128.     left    = word(dpos, 1)
  129.     top     = word(dpos, 2)
  130.  
  131.     newbox  = ppm_CloneBox(source, 0, 0)
  132.  
  133.     call ppm_SetBoxSize(newbox, word(dsize, 1), word(dsize, 2))
  134.     call ppm_SetBoxAngle(newbox, dangle)
  135.     call ppm_SetBoxPosition(newbox, left, top)
  136.     call ppm_SetBoxTextWrap(newbox, word(dimperm, 1), word(dimperm, 2))
  137.     call ppm_SetBoxLock(newbox, dlock)
  138.     call ppm_SetBoxHide(newbox, dhide)
  139.     call ppm_SetBoxFrame(newbox, dframe)
  140.     call ppm_SetBoxTransparent(newbox, dtrans)
  141.     interpret "call ppm_SetBoxFrameData(newbox, "separate(ddata)")"
  142.     interpret "call ppm_SetBoxOffset(newbox, "separate(dboxoff)")"
  143.     interpret "call ppm_SetBoxStandOff(newbox, "separate(dsoff)")"
  144.     interpret "call ppm_SetBoxMargins(newbox, "separate(dmargs)")"
  145.  
  146.    dellist = dellist';'dest
  147.    grplist = grplist';'newbox
  148.    return
  149. end
  150.  
  151. separate: procedure
  152. do
  153.     parse arg string
  154.  
  155.     output = ''
  156.  
  157.         cr = pos('0a'x, string)
  158.  
  159.         if cr ~= 0 then
  160.         do
  161.  
  162.                 do while string ~= ''
  163.  
  164.                         parse var string val '0a'x string
  165.                         output = output||"'"val"',"
  166.                 end
  167.                 output = delstr(output, length(output))
  168.         end
  169.         else
  170.         do
  171.             wrds    = words(string)
  172.  
  173.             do i = 1 to wrds - 1
  174.  
  175.                    output = output||word(string, i)", "
  176.  
  177.             end
  178.  
  179.             output = output || word(string, wrds)
  180.  
  181.         end
  182.  
  183.     return(output)
  184.  
  185. end
  186.  
  187. exit_msg: procedure
  188. do
  189.     parse arg message
  190.  
  191.     if message ~= '' then call ppm_Inform(1,message,)
  192.     call ppm_ClearStatus()
  193.     call ppm_AutoUpdate(1)
  194.     exit
  195. end
  196.  
  197.  
  198.